﻿<local:DocumentBase x:Class="WPFExcelReport.MVTINVOICE"
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
          xmlns:local="clr-namespace:ReflectionStudio.Components.UserControls;assembly=ReflectionStudio.Core" 
        xmlns:wep="clr-namespace:WPFExcelReport"
        xmlns:ucd="clr-namespace:ReflectionStudio.Controls;assembly=ReflectionStudio.Controls"
      
       Background="White" 
         Loaded="Window_Loaded"
      
     >
    <local:DocumentBase.Resources>
        <ucd:DD2ColorConverter  x:Key="dd2color"/>
    </local:DocumentBase.Resources>
    <Grid DataContext="{Binding}">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="1*" /> 
        </Grid.RowDefinitions> 
        <StackPanel >
            <WrapPanel  >
                <Label Content="PI#："    Width="38" Margin="10,0,0,0"  HorizontalAlignment="Left"     VerticalAlignment="Center" Foreground="#FF141111" />
                <TextBox Name="txtPI" Width="157" Margin="10,0,0,0"  HorizontalAlignment="Left" Panel.ZIndex="3"
                         KeyUp="txtART_KeyUp" Focusable="True" CharacterCasing="Upper" Background="Beige" MaxLength="20"  Foreground="#FF141111"  />
                <Label Content="RE发票号："    Width="83" Margin="10,0,0,0"  HorizontalAlignment="Left"     VerticalAlignment="Center" Foreground="#FF141111" />
                <TextBox Name="txtINVOICE" Width="114" Margin="10,0,0,0"  HorizontalAlignment="Left" Panel.ZIndex="0"
                         KeyUp="txtART_KeyUp" Focusable="True" CharacterCasing="Upper" Background="Pink" MaxLength="8" Foreground="#FF141111" />
                <Label Content="代理简称："    Width="84" Margin="10,0,0,0"  HorizontalAlignment="Left"     VerticalAlignment="Center" Foreground="#FF141111" />
                <TextBox Name="txtAGENT" Width="87" Margin="10,0,0,0"  HorizontalAlignment="Left" Background="GhostWhite" Panel.ZIndex="5"
                         KeyUp="txtART_KeyUp" CharacterCasing="Upper" MaxLength="10"   Foreground="#FF141111" Height="33" />
                <Label Content="RE状态："    Width="65" Margin="10,0,0,0"  HorizontalAlignment="Left"    VerticalAlignment="Center" Foreground="#FF141111" />
                <CheckBox Content="已付款"   Name="cbSTATUS" Background="WhiteSmoke" />
            </WrapPanel>
        
            <WrapPanel >
                <Label Content="客户简称："    Width="84" Margin="10,0,0,0"  HorizontalAlignment="Left"   FontSize="18" VerticalAlignment="Center" Foreground="#FF141111" />
                <TextBox Name="txtKUNDNR" Width="87" Margin="10,0,0,0"  HorizontalAlignment="Left" Background="Pink" Panel.ZIndex="5"
                         KeyUp="txtART_KeyUp" CharacterCasing="Upper" MaxLength="10" FontSize="18" Foreground="#FF141111" Height="33" />
                <Label Content="销售下单日期从" Height="26" HorizontalAlignment="Left" Margin="10,5,0,0" Name="label3" VerticalAlignment="Top" Width="131" FontSize="18" />
                <DatePicker Height="25" HorizontalAlignment="Left" Margin="0,2,0,0" Name="FROM_DATE" VerticalAlignment="Top" 
                                SelectedDateChanged ="FROM_DATE_SelectedDateChanged" Width="118" />
                <Label Content="至" Height="28" HorizontalAlignment="Left" Margin="10,5,0,0" Name="label4" VerticalAlignment="Top" Width="19" FontSize="18" />
                <DatePicker Height="25" HorizontalAlignment="Left" Margin="0,2,0,0" Name="END_DATE" VerticalAlignment="Top" 
                                SelectedDateChanged ="END_DATE_SelectedDateChanged" Width="118" />
                <Button Content="查询数据" Height="33" Margin="10,0,0,0"  Name="btnQuery" Width="73" Panel.ZIndex="8"
                        Click="btnQuery_Click"/>
                <Button Content="导出EXCEL" Height="33" Margin="10,0,0,0"  Name="btnEXCEL" Width="73" Panel.ZIndex="9"
                        Click="btnEXCEL_Click"/>
            </WrapPanel>
           
        </StackPanel>
        <DataGrid CanUserReorderColumns="True" 
                          CanUserResizeRows="True" CanUserSortColumns="True"
                          AutoGenerateColumns="False"   
                  EnableRowVirtualization="True"  
              Grid.Row="1"
                  EnableColumnVirtualization="True"  
                  ScrollViewer.HorizontalScrollBarVisibility="Auto"
                  ScrollViewer.VerticalScrollBarVisibility="Auto"
                  RowDetailsVisibilityMode="VisibleWhenSelected" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
                                IsSynchronizedWithCurrentItem="True" Opacity="10" Visibility="Visible"
                               ItemsSource="{Binding}" x:Name="MasterDg" 
                                Margin="0,10,0,0"   DataContext="{Binding}">
            <!--KDKUNDNA	VKPAUFKRS	VKPAUFLFD	VKPAUFPOS	PI	ADPAY	RE	VRPREPOS	VRKWAEHRSL GU	GS	VRPLIEFSCH	
                    VRKKOMPL	LITOT	VRPART	VRPFARBE	VRQTY	VRPMEEH	VRPRICE	VRPPREH	AGENT	
                    RATE	ENDINVOICE	AGINVOICE	COMMISSION-->
            <DataGrid.Columns>
                <DataGridTextColumn Binding="{Binding Path=KDKUNDNA}" Header="客户简称" Width="SizeToCells" MinWidth="30" />
                <DataGridTextColumn Binding="{Binding Path=AGENT}" Header="代理简称" Width="SizeToCells" MinWidth="30" />
                <DataGridTextColumn Binding="{Binding Path=PI}" Header="PI#" Width="SizeToCells" MinWidth="50" />
                <DataGridTextColumn Binding="{Binding Path=ADPAY}" Header="PI预付款" Width="SizeToCells" MinWidth="30" />
                <DataGridTextColumn Binding="{Binding Path=VRKWAEHRSL}" Header="货币" Width="SizeToCells" MinWidth="30" />
                <DataGridTextColumn Binding="{Binding Path=RE}" Header="RE发票号" Width="SizeToCells" MinWidth="40" />
                <DataGridTextColumn Binding="{Binding Path=VRPREPOS}" Header="行号" Width="SizeToCells" MinWidth="40" />
                <DataGridTextColumn Binding="{Binding Path=VRKKOMPL}" Header="RE状态" Width="SizeToCells" MinWidth="20" />
                <DataGridTextColumn Binding="{Binding Path=GU}" Header="GU发票号" Width="SizeToCells" MinWidth="40" />
                <DataGridTextColumn Binding="{Binding Path=GS}" Header="GS发票号" Width="SizeToCells" MinWidth="40" />
                <DataGridTextColumn Binding="{Binding Path=VRPLIEFSCH}" Header="发货单号" Width="SizeToCells" MinWidth="40" />
                <DataGridTextColumn Binding="{Binding Path=VRPART}" Header="品种" Width="SizeToCells" MinWidth="40"/>
                <DataGridTextColumn Binding="{Binding Path=VRPFARBE}" Header="颜色" Width="SizeToCells" MinWidth="30" />
                <DataGridTextColumn Binding="{Binding Path=VRQTY}" Header="订单量" Width="SizeToCells" MinWidth="40" />
                <DataGridTextColumn Binding="{Binding Path=VRPMEEH}" Header="单位" Width="SizeToCells" MinWidth="30" />
                <DataGridTextColumn Binding="{Binding Path=VRPRICE}" Header="单价" Width="SizeToCells" MinWidth="30" />
                <DataGridTextColumn Binding="{Binding Path=VRPPREH}" Header="单位" Width="SizeToCells" MinWidth="30" />
                <DataGridTextColumn Binding="{Binding Path=INVOICE}" Header="RE金额" Width="SizeToCells" MinWidth="50" />
                <DataGridTextColumn Binding="{Binding Path=ENDINVOICE}" Header="GU金额" Width="SizeToCells" MinWidth="30" />
                <DataGridTextColumn Binding="{Binding Path=AGINVOICE}" Header="GS金额" Width="SizeToCells" MinWidth="30" />
                <DataGridTextColumn Binding="{Binding Path=RATE}" Header="佣金比例" Width="SizeToCells" MinWidth="30" />
                <DataGridTextColumn Binding="{Binding Path=COMMISSION}" Header="佣金" Width="SizeToCells" MinWidth="40" />

            </DataGrid.Columns>
        </DataGrid>
    </Grid>
</local:DocumentBase>
